package com.mlh.myspring.ioc;


import com.mlh.myspring.component.MonsterDao;
import com.mlh.myspring.component.MonsterService;
import com.mlh.myspring.component.SmartAnimalAspect;
import com.mlh.myspring.component.UsbInterface;

public class MlhSpringApplicationContextTest {
    public static void main(String[] args) {
        MlhSpringApplicationContext ioc = new MlhSpringApplicationContext(MlhSpringConfig.class);
        // MonsterDao monsterDao1 = (MonsterDao)ioc.getBean("monsterDao");
        // System.out.println(monsterDao1);
        // MonsterDao monsterDao2 = (MonsterDao)ioc.getBean("monsterDao");
        // System.out.println(monsterDao2);
        // MonsterService monsterService1 = (MonsterService)ioc.getBean("monsterService");
        // System.out.println(monsterService1);
        // MonsterService monsterService2 = (MonsterService)ioc.getBean("monsterService");
        // System.out.println(monsterService2);

        //MonsterService monsterService = (MonsterService)ioc.getBean("monsterService");
        //monsterService.method1();

        //测试AOP
        UsbInterface phone = (UsbInterface)ioc.getBean("phone");
        phone.work();
        phone.close();
        MonsterService monsterService = (MonsterService)ioc.getBean("monsterService");
        monsterService.method1();
    }
}
